﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Text.RegularExpressions;

/*
 * Ce fichier peut contenir plusieurs DataContract.
 * Voir exemple ci-dessous (question pratique).
 * Definition DataContract: Contrat de donnée entre le serveur WCF et les différents client
 */
namespace KerriganDataContract.Person
{
    
    /// <summary>
    /// Premier exemple de creation d'un DataContract 
    /// </summary>
    [DataContract]
    public class PersonDC : INotifyPropertyChanged
    {

        private Int32 _idPerson;

        private String _lastName;

        private String _firstName;

        private String _nickName;

        private String _password;

        private String _email;

        private DateTime? _birthday;

        private String _phoneNumber;

        private String _adress;

        private String _city;

        private string _postCode;

        private int _type;


        [DataMember]
        public Int32 IdPerson {
            get
            {
                return this._idPerson;
            }
            set
            {
                this._idPerson = value;
                OnPropertyChanged("IdPerson");
            }
        }

        [DataMember]
        public String LastName {
            get
            {
                return this._lastName;
            }
            set
            {

                this._lastName = value;
                OnPropertyChanged("LastName");
            }
        }

        [DataMember]
        public String FirstName { 
            get
            {
                return this._firstName;
            }
            set
            {

                this._firstName = value;
                OnPropertyChanged("FirstName");
            }
        }

        [DataMember]
        public String NickName {
            get
            {
                return this._nickName;
            }
            set
            {

                this._nickName = value;
                OnPropertyChanged("NickName");
            }
        }

        [DataMember]
        public String Password {
            get
            {
                return this._password;
            }
            set
            {

                this._password = value;
                OnPropertyChanged("Password");
            } 
        }

        [DataMember]
        public String Email {
            get
            {

                return this._email;
            }
            set
            {

                this._email = value;
                OnPropertyChanged("Email");
            }
        }

        [DataMember]
        public DateTime? Birthday {
            get
            {
                return this._birthday;
            }
            set
            {
                this._birthday = value;
                OnPropertyChanged("Birthday");
            }
        }

        [DataMember]
        public String PhoneNumber {
            get
            {
                return this._phoneNumber;
            }
            set
            {

                this._phoneNumber = value;
                OnPropertyChanged("PhoneNumber");
            }
        }

        [DataMember]
        public String Adress {
            get
            {

                return this._adress;
            }
            set
            {

                this._adress = value;
                OnPropertyChanged("Adress");
            }
        }

        [DataMember]
        public String City { 
            get
            {
                return this._city;
            }
            set
            {

                this._city = value;
                OnPropertyChanged("City");
            }
        }

        [DataMember]
        public String PostCode
        {
            get
            {
                return this._postCode;
            }
            set
            {

                this._postCode = value;
                OnPropertyChanged("PostCode");
            }
        }



        [DataMember]
        public Int32 Type
        {
            get
            {
                return this._type;
            }
            set
            {

                this._type = value;
            }
        }

        private void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
